// 稀有度
export enum RarityEnum {
  BRONZE = 'BR',
  SILVER = 'SR',
  GOLD = 'GR',
  LEGEND = 'LG',
  LD = 'LD',
  UR = 'UR',
  SL = 'SL',
  TOKEN = 'Token',
}

// 平/闪
export enum FoilEnum {
  FLAT,
  FLASH,
}

export type CardDetail = {
  card_id: number; //卡牌id
  name: string; //卡牌名称
  ename: string; //卡牌外文名称
  img: string; //卡牌图片
  card_class: string; //卡牌类别 普通，进化
  rarity: RarityEnum; //卡牌稀有度 BR-青铜，LG-传说，GR-黄金，SR-白银
  is_foil: FoilEnum; //平闪 1-闪，0-平
  card_career: string; //职业 中立，精灵，皇家，巫师，龙族，梦魇，主教
  card_category: string; //卡牌类型 随从，法术，护符
  rule: string; //规则
  description: string; //描述
  series_name: string; //系列中文名
  card_no: string; //卡牌编号
  attr: string; //属性
  attack: number; //攻击力 -1为空
  defense: number; //防御力 -1为空
  mana: number; //法术力 -1为空
  publish_time: number; //发布时间 格式为 20220501
  min_price: number; //最低价
  link_card_id: number; //关联牌id ，普通牌对应的是进化牌id，进化牌对应的是普通牌id 没有为0
  other_version: OtherCardVerse[];
};

export type OtherCardVerse = Pick<CardDetail, 'card_id' | 'name' | 'ename' | 'is_foil' | 'series_name' | 'card_no'>;

export type CardItem = Writable<
  Pick<CardDetail, 'card_id' | 'name' | 'card_career' | 'img' | 'is_foil'> & {
    thumbnail: string;
    other_ename: string;
  }
>;

export type CardList = {
  total: number;
  rows: Array<CardItem>;
};

export enum CardType {
  WARRIOR = 1,
  MAIN,
  BACKUP,
}

export type CardListQuery = Writable<
  Partial<Record<keyof Pick<CardDetail, 'rarity' | 'card_career' | 'card_category' | 'mana'>, string[]>> & {
    card_type?: CardType;
    message?: string;
    series_id?: string[];
    page: number;
    page_size: number;
  }
>;
